﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Northwind.NET.FE.Forms
{
    public partial class SalesByYearDialog : Form
    {
        public SalesByYearDialog()
        {
            InitializeComponent();
        }

        private void SalesByYearDialog_Load(object sender, EventArgs e)
        {
            enterBeginningDate.Value = DateTime.Now.AddDays(-31);
            enterEndingDate.Value = DateTime.Now;   
        }

        public bool ShowDetails { get { return showDetailsCheckBox.Checked; } }
        public DateTime BeginningDate { get { return enterBeginningDate.Value.Date ; } }
        public DateTime EndingDate { get { return enterEndingDate.Value.Date; } }
        
        private void okButton_Click(object sender, EventArgs e)
        {
            string message = string.Format("TODO: BeginningDate = {0:dd/MMM/yyyy}, EndingDate = {1:dd/MMM/yyyy}, ShowDetails = {2}",
                                  BeginningDate, EndingDate, ShowDetails);
            MessageBox.Show(message, Globals.APPLICATION_TITLE);  

        }

        private bool _cancelButtonClicked;
        private void cancelButton_Click(object sender, EventArgs e)
        {
            _cancelButtonClicked = true;
            MessageBox.Show("TODO: Return focus to the caller form", Globals.APPLICATION_TITLE);
            this.Close(); 
        }

        private void SalesByYearDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            //TODO: return focus to the calling form here in
            // the case of Cancel button clicked
        }
    
    }
}
